﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TourAgency.Admin.Modify
{
    public partial class EditBoard : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["editBoard"] != null)
                {
                    int editBoardID = int.Parse(Session["editBoard"].ToString());
                    ToursAgencyDAL.Board editBoard = ToursAgencyDAL.ToursAgencyDataFuncs.GetBoardByID(editBoardID);
                    this.textBoxName.Text = editBoard.Name;
                }
            }
        }

        protected void buttonSaveBoard_Click(object sender, EventArgs e)
        {
            ToursAgencyDAL.Board board = new ToursAgencyDAL.Board();
            int editBoardID = int.Parse(Session["editBoard"].ToString());
            board.ID = editBoardID;
            board.Name = this.textBoxName.Text;
            ToursAgencyDAL.ToursAgencyDataFuncs.EditBoard(board);
            Response.Redirect("~/Admin/Boards.aspx");
        }
    }
}